package com.wuchao.ehcache.controller;

import com.wuchao.ehcache.entity.User;
import com.wuchao.ehcache.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author WuChao
 * @version 1.0
 * @date 2020/4/22 11:26
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    @GetMapping("/get")
    public User getUser(Integer id) throws ClassNotFoundException {

        return userService.get(id);
    }

    @GetMapping("/remove")
    public Boolean remove(Integer id) {
        return userService.delete(id);

    }
}
